﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Gmis.Public;
namespace Gmis.Web.UI
{
	public partial class LeaveWord : System.Web.UI.Page
	{
		protected void Page_Load(object sender, EventArgs e)
		{

		}

        protected void Button1_Click(object sender, EventArgs e)
        {

            string strErr = "";

            if (this.txtTitle.Text.Trim().Length == 0)
            {
                strErr += "标题不能为空！\\n";
            }
            if (strErr != "")
            {
                Response.Write("<script>alert('" + strErr + "');</script>");
                return;
            }
            string Id = CommonFunction.GetGuid();
            string Title = this.txtTitle.Text;
            string contents = this.txtcontents.Text;
            string phone = this.txtphone.Text;
            string contactForm = this.txtcontactForm.Text;
            DateTime leaveWordTime = DateTime.Now;
            DateTime replyTime = DateTime.Now;
            string replyPerson = "";
            string replyContents = "";
            string leaveWordPerson = this.txtleaveWordPerson.Text;


            Gmis.Model.LeaveWord model = new Gmis.Model.LeaveWord();
            model.Id = Id;
            model.Title = Title;
            model.contents = contents;
            model.phone = phone;
            model.contactForm = contactForm;
            model.leaveWordTime = leaveWordTime;
            model.replyTime = replyTime;
            model.replyPerson = replyPerson;
            model.replyContents = replyContents;
            model.leaveWordPerson = leaveWordPerson;
            model.IsShow = true;
            try
            {
                Gmis.BLL.LeaveWord bll = new Gmis.BLL.LeaveWord();
                bll.Add(model);
                Response.Write("<script>alert('恭喜你,提交成功,我们会尽快答复！');parent.location='/index.aspx'</script>");
            }
            catch
            {
                Response.Write("<script>alert('糟糕,提交失败！');parent.location='/index.aspx'</script>");

            }

        }
	}
}